#include ".\gameobject.h"

UINT CGameObject::m_nCount = 0;
CLogFile CGameObject::m_LogFile;
CConsoleWnd CGameObject::m_ConsoleWnd;
HWND CGameObject::m_hWnd = NULL;
char CGameObject::m_szAssertString[4096] = {0};

CGameObject::CGameObject(void)
{
	m_ObjectType = OT_Null;
	m_nObjectNumber = m_nCount;
	m_nCount++;
//#ifdef _DEBUG
	if (m_nCount == 1)
	{
		m_LogFile.Create("GameLogFile.log");
		m_ConsoleWnd.DiableCloseButton();
	}
//#endif	
}

CGameObject::~CGameObject(void)
{
	m_nCount--;
}

const UINT CGameObject::GetObjectCout()
{
	return m_nCount;
}

const UINT CGameObject::GetObjectNumber()
{
	return m_nObjectNumber;
}

void CGameObject::PrintLogToConsoleWindow(string strLog)
{
	m_ConsoleWnd.PrintLog(strLog.c_str());
	return;
}

void CGameObject::PrintLogToLogFile(string strLog)
{
	m_LogFile.PrintLogString(strLog.c_str());
	return;
}

void CGameObject::MyASSERT(BOOL bValue,string strMsg)
{
	if (!bValue)
	{
		assert(0 && strMsg.c_str());
		PrintLogToConsoleWindow(strMsg);
		PrintLogToLogFile(strMsg);
	}
	return;
}

void CGameObject::SetWnd(HWND hWnd)
{
	m_hWnd = hWnd;
}
